\psset{unit=0.7,algebraic}
\begin{pspicture*}(-4,-3)(4,3)
\psaxes[labelFontSize=\scriptstyle,ticksize=-3pt
0,labelsep=2pt,trigLabels=true,trigLabelBase=2,dx=\psPiH,xunit=\psPi]{<->}(0,0)(-4,-3)(4,3)
\psplot[linecolor=blue]{-4}{-1.5708}{tan(x)}
\psplot[linecolor=blue]{-1.5707}{1.5707}{tan(x)}
\psplot[linecolor=blue]{1.5708}{4}{tan(x)}
\footnotesize
\rput[l](1,1.2){$f(x)=\tg x$}
\psline[linecolor=red]{|-|}(-3.1415,0)(3.1415,0)
\rput[t](0.5,-0.1){\color{red}$2\pi$}
\end{pspicture*}